Modifying a group's sort direction at runtime

You can change a group's sort direction through the SortDirection property of the Area Object. To change a group's sort direction you can use code similar to the following:

Note:    All the samples are based on the sample database, XTREME.MDB, which is installed by Crystal Reports.

  1. Put this code in the General Declarations section.
Dim CRXReport As New CrystalReport1 
  1. Put this code in the FORM_LOAD event procedure.
Private Sub Form_Load() 

The Item parameter "GH1" refers to the first group header; to access the second group header you would use "GH2" This line of code sets the SortDirection to descending.

CRXReport.Areas.Item("GH1").SortDirection = crDescendingOrder
  1. Finally, view the report.
CRViewer1.ReportSource = CRXReport 
CRViewer1.ViewReport 
End Sub 


Seagate Software IMG Holdings, Inc.
http://www.seagatesoftware.com
Support services:
http://support.seagatesoftware.com